/**
 * 
 */
package pl.edu.mimuw.irs.core.model.design.net;

import java.util.LinkedList;
import java.util.List;

import pl.edu.mimuw.irs.core.model.design.net.refinement.IRSAbstractChildren;

/**
 * @author Jakub Rauch
 * Created on: 2010-03-01
 */
@Deprecated
public class IRSNodeUtils {

	// *** Attributes

	// *** Methods
	
	/** Returns all nodes which are the 'output' nodes. These includes all nodes that are returned by 
	 * {@link IRSAbstractChildren#getOutputNodes()} as well as the provided node itself. */
	public List<IRSNode> getAllOutputNodes(IRSNode node) {
		List<IRSNode> outputNodes = new LinkedList<IRSNode>();
		for (IRSNode outputChild : node.getChildren().getOutputNodes()) outputNodes.addAll(getAllOutputNodes(outputChild));
		outputNodes.add(node);
		return outputNodes;
	}

	/** Returns all nodes which are the 'input' nodes. These includes all nodes that are returned by 
	 * {@link IRSAbstractChildren#getInputChildren()} as well as the provided node itself. */
	public List<IRSNode> getAllInputNodes(IRSNode node) {
		List<IRSNode> inputNodes = new LinkedList<IRSNode>();
		for (IRSNode inputChild : node.getChildren().getInputChildren()) inputNodes.addAll(getAllInputNodes(inputChild));
		inputNodes.add(node);
		return inputNodes;
	}
}
